#include "colorutils.h"

namespace colorutils {
    int rgbaToRGB(int rgb_bg_red, int rgb_bg_green, int rgb_bg_blue,
                  int rgba_c_red, int rgba_c_green, int rgba_c_blue, float alpha) {

        // Calculate the blended RGB values
        int red = static_cast<int>((1 - alpha) * rgb_bg_red + alpha * rgba_c_red);
        int green = static_cast<int>((1 - alpha) * rgb_bg_green + alpha * rgba_c_green);
        int blue = static_cast<int>((1 - alpha) * rgb_bg_blue + alpha * rgba_c_blue);

        // Convert integers to hexadecimal strings with leading zeros if necessary
        int rgba = red << 16 | green << 8 | blue << 0;

        return rgba;
    }
}
